import request from '@/utils/request'
import { getToken } from '@/utils/auth'

// 获取车票分类
export function getTicketCategories() {
  return request({
    url: '/ticket/ticketClass',
    method: 'get'
  })
}
// 获取车票项目
export function getTicketSubjects(params) {
  return request({
    url: '/ticket/ticketSubjectLayerList',
    method: 'get',
    params
  })
}
// 创建订单
export function createTicketOrder(data) {
  return request({
    url: '/order/createOrder',
    method: 'post',
    headers: { 'content-type': 'application/x-www-form-urlencoded', token: getToken() },
    params: data
  })
}
//获取订单列表
export function getTicketOrderList(data) {
  return request({
    url: '/order/getMyOrderInfo',
    method: 'get',
    headers: { 'content-type': 'application/x-www-form-urlencoded', token: getToken() },
    params: data
  })
}

// 查看订单详情
export function getTicketOrderDetail(data) {
  return request({
    url: '/order/getOrderDetail',
    method: 'get',
    headers: { 'content-type': 'application/x-www-form-urlencoded', token: getToken() },
    params: data
  })
}

//删除订单
export function deleteTicketOrder(data) {
  return request({
    url: '/order/deleteOrder',
    method: 'get',
    headers: { 'content-type': 'application/x-www-form-urlencoded', token: getToken() },
    params: data
  })
}

//更新订单号
export function updateOrderCode(data) {
  return request({
    url: '/order/updateOrderCode',
    method: 'get',
    headers: { 'content-type': 'application/x-www-form-urlencoded', token: getToken() },
    params: data
  })
}
